﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace StorageBox
{
    /// <summary>
    /// 这个组合元素拥有全局唯一性
    /// </summary>
    public class AddApplyElement : ShowMessageBase
    {
        private TextBox applyPath;
        private TextBox iconPath;
        private Button conifomBut;
        private WrapPanel back;

        public AddApplyElement() { }

        public AddApplyElement(AddApplyData data)
        {
            this.applyPath = data.applyPath;
            this.iconPath = data.iconPath;
            this.conifomBut = data.conifomBut;
            this.back = data.back;

            Empty();

            //RootElement.Parent
            if (back.Parent != null)
            {
                ((StackPanel)(back.Parent)).Children.Clear();
            }
            //back.Parent.ClearValue(back);//之前的逻辑父元素是没有消失的

            RootElement.Children.Add(back);
        }

        private void Empty()
        {
            applyPath.Text = "";
            iconPath.Text = "";
        }

    }
}
